package com.bnq.control.desktop.popup;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;

import com.bnq.control.desktop.xmlview.OnPrepareViewDelegate;
import com.bnq.control.desktop.xmlview.OnSubViewClickListener;
import com.bnq.control.desktop.xmlview.XmlView;


public class XmlPopup extends Popup {

	protected XmlView mXmlView;

	public XmlPopup(Context context) {
		super(context);
	}

	public XmlPopup(Context context, int layoutRes) {
		super(context, layoutRes);
	}

	protected void onInitView(View rootView) {
		if (null == mXmlView) {
			mXmlView = new XmlView(rootView);
			mXmlView.setSender(this);
		}
		onInitView(rootView, mXmlView);
	}

	protected void onInitView(View rootView, OnClickListener l) {

	}

	public void setOnSubViewClickListener(OnSubViewClickListener l) {
		mXmlView.setOnSubViewClickListener(l);
	}

	public void setOnPrepareViewDelegate(OnPrepareViewDelegate delegate) {
		mXmlView.setOnPrepareViewDelegate(delegate);
	}

	@Override
	public void show(View token) {
		mXmlView.setVisibility(View.VISIBLE);
		super.show(token);
	}
}
